using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameConfig
{

    public static int version = 0;


    public const string ResourceDir = "GameRes/";           //素材目录
    public const string ExtName = ".unity3d";                   //素材扩展名
    public const string AssetDir = "StreamingAssets";           //素材目录 

#if UNITY_EDITOR
    public static bool IsUpdate = false;
#else
    public static bool IsUpdate = true;
#endif
    public const string AppName = "mj_xiaoxiaole";               //应用程序名称
    public static string WebUrl
    {
        get
        {
            string catalog = "/Android/"; //"/Windows/";
            if (Application.platform == RuntimePlatform.Android)
            {
                catalog = "/Android/";
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                catalog = "/IOS/";
            }
            else if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                catalog = "/WebGL/";
            }
           // return "http://47.92.115.147:5028/test" + catalog + "StreamingAssets/";
           // "http://dlgame2.teenpattiokay.com:808/front/Download/Phone/Android10/StreamingAssets/"
           //测试
           // return "http://dlgame2.teenpattiokay.com:808/front/Download/Phone" + catalog + "StreamingAssets/";
           //正式
           return "https://www.zzsygame.com/Phone" + catalog + "StreamingAssets/";
           
            //return "http://43.205.41.47:8080/Download/Phone" + catalog + "StreamingAssets/";
            //return "http://127.0.0.1/Download/Phone" + catalog + "StreamingAssets/";
        }
    }
    //测试
    public static string DownloadActiveUrl = "http://dlgame2.teenpattiokay.com:808/front/Download/Phone/Android/Texture/";
    //正式
    //public static string DownloadActiveUrl = "http://43.205.41.47:8080/Download/Phone/Android/Texture/";
    public static string GetRelativePath()
    {
        if (Application.isEditor)
            return "file://" + System.Environment.CurrentDirectory.Replace("\\", "/") + "/Assets/" + AssetDir + "/";
        else if (Application.isMobilePlatform || Application.isConsolePlatform)
            return "file:///" + DataPath;
        else // For standalone player.
            return "file://" + Application.streamingAssetsPath + "/";
    }

    /// <summary>
    /// 取得数据存放目录
    /// </summary>
    public static string DataPath
    {
        get
        {

            //return Application.dataPath + "/" + AppConst.AssetDir + "/";

            string game = AppName.ToLower();
            if (Application.isMobilePlatform || Application.platform == RuntimePlatform.WebGLPlayer)
            {
                return Application.persistentDataPath + "/" + game + "/";
            }

            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                int i = Application.dataPath.LastIndexOf('/');
                return Application.dataPath.Substring(0, i + 1) + game + "/";
            }
            return "c:/" + game + "/";
        }
    }

    /// <summary>
    /// 应用程序内容路径
    /// </summary>
    public static string AppContentPath()
    {
        string path = string.Empty;
        switch (Application.platform)
        {
            case RuntimePlatform.Android:
                path = "jar:file://" + Application.dataPath + "!/assets/";
                //path = Application.streamingAssetsPath + "/";
                break;
            case RuntimePlatform.IPhonePlayer:
                path = Application.dataPath + "/Raw/";
                break;
            case RuntimePlatform.WebGLPlayer:
                path = Application.streamingAssetsPath + "/";
                break;
            default:
                path = Application.dataPath + "/" + AssetDir + "/";
                break;
        }
        return path;
    }

}
